<?php

namespace app\utils\ui\ele;

use app\utils\ui\UIView;
use app\utils\ui\vue\Base;
use app\utils\ui\VueView;

class TableColumn extends Base implements VueView{

    /**
     * @param UIView $child 自定义column，不支持数组
     */
    public function __construct($col_name,$col_field,$width=null,$child=null)
    {
        $attr=[
            'prop'=>$col_field,
            'label'=>$col_name,
        ];
        if($width){
            $attr['width']=$width;
        }
        $childs = [];
        if($child){
            $childs[]=$child;
        }
        parent::__construct($attr,$childs);
    }

    public function render(){
        return parent::base_render('el-table-column');
    }
    
}